window.daicuo.cms = {
    init: function(){
        this.imageFluid();
        this.videoFluid();
        this.infoUpClick();
        this.searchDropdown();
    },
    imageFluid: function(){
        $('.content img').addClass('d-block img-fluid mx-auto');
    },
    videoFluid: function(){
        $('.dc-player').addClass('embed-responsive embed-responsive-16by9');
    },
    infoUpClick: function(){
        $(document).on("click", '[data-toggle="infoUp"]', function() {
            $(this).addClass('disabled');
            var btn = $(this).find('.infoUpValue');
            daicuo.ajax.get($(this).attr('href'), function($data, $status, $xhr) {
                if($data.code == 1){
                    btn.text($data.value);
                }
                
            });
            return false;
        });
    },
    searchDropdown: function(){
        $('#search .dropdown-item').on('click', function(){
            var form   = $(this).parents('form');
            var button = $(this).parent().prev('button');
            //button
            var buttonText = button.text();
            button.text($(this).text());
            $(this).text(buttonText);
            //action
            var formAction = $(this).attr('data-href');
            $(this).attr('data-href',form.attr('action'));
            form.attr('action',formAction);
            //target
            var formTarget = $(this).attr('data-target');
            $(this).attr('data-target',form.attr('target'));
            form.attr('target',formTarget);
            //关闭下拉
            button.dropdown('hide');
        });
    }
};
//主题JS
$(document).ready(function() { 
    //框架脚本初始化
    window.daicuo.init();
    //主题脚本初始化
    window.daicuo.cms.init();
});